package com.yida.gwj.expend.outside.domain.request;

import java.time.LocalDate;
import java.util.List;

import com.yida.common.core.exception.ServiceException;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 查询验收报告请求参数
 *
 * @author wkz
 * @date 2023/03/15
 */
@ApiModel(description = "查询验收报告请求参数")
public class AcceptanceReportRequest {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "业务id")
    private Long bizId;

    @ApiModelProperty(value = "建设单位")
    private String constructionUnit;

    @ApiModelProperty(value = "设计单位")
    private String designer;

    @ApiModelProperty(value = "监理单位")
    private String controlUnit;

    @ApiModelProperty(value = "开工时间")
    private LocalDate commencementTime;

    @ApiModelProperty(value = "工程概况")
    private String projectOverview;

    @ApiModelProperty(value = "验收内容")
    private String acceptanceContent;

    @ApiModelProperty(value = "验收意见")
    private String acceptanceAmount;

    @ApiModelProperty(value = "验收结论")
    private String acceptanceConclusion;

    @ApiModelProperty(value = "竣工验收人员签字列表")
    private List<AcceptancePersonnel> acceptancePersonnelList;

    @ApiModelProperty(value = "保存时间")
    private LocalDate saveTime;

    /**
     * 竣工验收人员签字
     *
     * @author wkz
     * @date 2023/03/14
     */
    public static class AcceptancePersonnel {
        @ApiModelProperty(value = "姓名")
        String name;
        @ApiModelProperty(value = "工作单位")
        String workUnit;
        @ApiModelProperty(value = "职务")
        String post;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getWorkUnit() {
            return workUnit;
        }

        public void setWorkUnit(String workUnit) {
            this.workUnit = workUnit;
        }

        public String getPost() {
            return post;
        }

        public void setPost(String post) {
            this.post = post;
        }
    }

    public String getDesigner() {
        return designer;
    }

    public void setDesigner(String designer) {
        this.designer = designer;
    }

    public String getControlUnit() {
        return controlUnit;
    }

    public void setControlUnit(String controlUnit) {
        this.controlUnit = controlUnit;
    }

    public String getProjectOverview() {
        return projectOverview;
    }

    public void setProjectOverview(String projectOverview) {
        this.projectOverview = projectOverview;
    }

    public String getAcceptanceContent() {
        return acceptanceContent;
    }

    public void setAcceptanceContent(String acceptanceContent) {
        this.acceptanceContent = acceptanceContent;
    }

    public String getAcceptanceAmount() {
        return acceptanceAmount;
    }

    public void setAcceptanceAmount(String acceptanceAmount) {
        this.acceptanceAmount = acceptanceAmount;
    }

    public String getAcceptanceConclusion() {
        return acceptanceConclusion;
    }

    public void setAcceptanceConclusion(String acceptanceConclusion) {
        this.acceptanceConclusion = acceptanceConclusion;
    }

    public List<AcceptancePersonnel> getAcceptancePersonnelList() {
        return acceptancePersonnelList;
    }

    public void setAcceptancePersonnelList(List<AcceptancePersonnel> acceptancePersonnelList) {
        this.acceptancePersonnelList = acceptancePersonnelList;
    }

    public Long getBizId() {
        return bizId;
    }

    public void setBizId(Long bizId) {
        this.bizId = bizId;
    }

    public String getConstructionUnit() {
        return constructionUnit;
    }

    public void setConstructionUnit(String constructionUnit) {
        this.constructionUnit = constructionUnit;
    }

    public LocalDate getCommencementTime() {
        return commencementTime;
    }

    public void setCommencementTime(LocalDate commencementTime) {
        this.commencementTime = commencementTime;
    }

    public LocalDate getSaveTime() {
        return saveTime;
    }

    public void setSaveTime(LocalDate saveTime) {
        this.saveTime = saveTime;
    }

    @Override
    public String toString() {
        return "AcceptanceReportRequest{" + "bizId=" + bizId + ", constructionUnit='" + constructionUnit + '\'' + ", designer='" + designer + '\'' + ", controlUnit='" + controlUnit + '\'' + ", commencementTime=" + commencementTime + ", projectOverview='" + projectOverview + '\'' + ", acceptanceContent='" + acceptanceContent + '\'' + ", acceptanceAmount='" + acceptanceAmount + '\'' + ", acceptanceConclusion='" + acceptanceConclusion + '\'' + ", acceptancePersonnelList=" + acceptancePersonnelList
            + ", saveTime=" + saveTime + '}';
    }

    public void checkNull() {
        if (StrUtil.isBlank(constructionUnit)) {
            throw new ServiceException("建设单位不能为空");
        }
        if (StrUtil.isBlank(designer)) {
            throw new ServiceException("设计单位不能为空");
        }
        if (StrUtil.isBlank(controlUnit)) {
            throw new ServiceException("监理单位不能为空");
        }
        if (ObjectUtil.isNull(commencementTime)) {
            throw new ServiceException("开工时间不能为空");
        }
        if (StrUtil.isBlank(projectOverview)) {
            throw new ServiceException("工程概况不能为空");
        }
        if (StrUtil.isBlank(acceptanceContent)) {
            throw new ServiceException("验收内容不能为空");
        }
        if (StrUtil.isBlank(acceptanceAmount)) {
            throw new ServiceException("验收意见不能为空");
        }
        if (StrUtil.isBlank(acceptanceConclusion)) {
            throw new ServiceException("验收结论不能为空");
        }
        if (CollectionUtil.isEmpty(acceptancePersonnelList)) {
            throw new ServiceException("竣工验收人员签字列表不能为空");
        }
    }
}
